var express =require("express");
var fs = require('fs');
var app = express();

app.get('/log', function (req, res) {
	var d = new Date();
	fileName = d.getFullYear() + "_" + d.getMonth() + "_" + d.getDate() + ".txt";
  	var filePath = __dirname + '/dist/log/' + fileName;
  	fs.appendFile(filePath, JSON.stringify(req.query) + '\n', function () {
		res.end();
  	});
});
app.enable('trust proxy');
app.set('trust proxy', '127.0.0.2');
app.use(express.static('.'))
    .use(express.static('./dist'))
    .listen(1205, "0.0.0.0");


